const { ccclass, property } = cc._decorator;

@ccclass
export default class EnemyManage extends cc.Component {
    @property(cc.Prefab)
    EnemyPre: cc.Prefab = null;

    start() {
        this.addEnemy();;
    }

    addEnemy() {
        this.schedule(() => {
            //实例化
            let Enemy = cc.instantiate(this.EnemyPre);
            //添加到场景
            Enemy.setParent(cc.director.getScene());
            //设置坐标,X随机数
            let RandX = Math.random() * 93
            RandX = Math.floor(RandX);
            Enemy.x = this.node.x + RandX;
            Enemy.y = this.node.y;
        },10,3,0)

    }

    // update (dt) {}
}
